[qemu] Make sure disk writes really made it to disk before we report I/O
authorchris@kneesaa.uk.xensource.com <chris@kneesaa.uk.xensource.com>
Fri, 4 Aug 2006 09:28:51 +0000 (10:28 +0100)
committerchris@kneesaa.uk.xensource.com <chris@kneesaa.uk.xensource.com>
Fri, 4 Aug 2006 09:28:51 +0000 (10:28 +0100)
completion to the guest domain.  The DMA_MULTI_THREAD functionality
from the qemu-dm IDE emulation should make the performance overhead
of synchronous writes bearable, or at least comparable to native
hardware.

Signed-off-by: Rik van Riel <riel@redhat.com>
tools/ioemu/block-bochs.c
tools/ioemu/block-cloop.c
tools/ioemu/block-cow.c
tools/ioemu/block-qcow.c
tools/ioemu/block-vmdk.c
tools/ioemu/block.c

index 62317aff38a83ac6937de56baaa2155581151a09..d82c2392818d454778495efc2993a88c19d717ea 100644 (file)
@@ -91,7 +91,7 @@ static int bochs_open(BlockDriverState *bs, const char *filename)
     int fd, i;
     struct bochs_header bochs;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
index c617e1b64bc3d2b391515b1413d0edba5f040b36..0f56685664b8eaa08498ced94f9ce387ee61fa56 100644 (file)
@@ -55,7 +55,7 @@ static int cloop_open(BlockDriverState *bs, const char *filename)
     BDRVCloopState *s = bs->opaque;
     uint32_t offsets_size,max_compressed_block_size=1,i;
 
-    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
+    s->fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE | O_SYNC);
     if (s->fd < 0)
         return -1;
     bs->read_only = 1;
index eeeab7068b729a9bfe0b80cb635ccb1bc1f26982..6a42a46ef4a363e82fd6174273d195e52f354733 100644 (file)
@@ -69,7 +69,7 @@ static int cow_open(BlockDriverState *bs, const char *filename)
     struct cow_header_v2 cow_header;
     int64_t size;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
index 34026a4f2c0f9d04f5c5f9c8aca4d32b206c8a7c..b28fe58d727ca69616ec8d30114c51872de74eea 100644 (file)
@@ -95,7 +95,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename)
     int fd, len, i, shift;
     QCowHeader header;
     
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
index fc87be353b701d4f7fa06c0180fa764475cda58d..03bbb7a765577317bd613b93c0960c48b3cd058c 100644 (file)
@@ -96,7 +96,7 @@ static int vmdk_open(BlockDriverState *bs, const char *filename)
     uint32_t magic;
     int l1_size;
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)
index 9c628f93bfaf0a432a8a28c23fd0ace1b50775fa..330d5c146d214635bb682ddba39eda53805eef9c 100644 (file)
@@ -677,7 +677,7 @@ static int raw_open(BlockDriverState *bs, const char *filename)
     int rv;
 #endif
 
-    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
+    fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE | O_SYNC);
     if (fd < 0) {
         fd = open(filename, O_RDONLY | O_BINARY | O_LARGEFILE);
         if (fd < 0)